/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-09-16
 * Time: 13:14
 */
public class test5 {
    public static void main(String[] args) {
        Object lock = new Object();
        new Thread(()->{
           synchronized (lock){
               System.out.println("t1:等待");
               try {
                   lock.wait();
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
               System.out.println("t1:唤醒");
           }
        }).start();

        new Thread(()->{
           synchronized (lock){
               System.out.println("t2:唤醒");
               lock.notify();
               System.out.println("t2:已经唤醒");
           }
        }).start();
    }
}
